home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Source / Libraries / mui / displaylist.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  3.6 KB  |  155 lines  |  [TEXT/CWIE]

  1. /*
  2.  * Copyright (c) 1993-1997, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED 
  4.  * Permission to use, copy, modify, and distribute this software for 
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that 
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission. 
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  * 
  25.  * US Government Users Restricted Rights 
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
  36.  */
  37.  
  38. #include "displaylist.h"
  39. #include "glut.h"
  40. #include <string.h>
  41.  
  42. #define MOVE2I    1
  43. #define DRAW2I    2
  44. #define RECTFI    3
  45. #define CMOV2I    4
  46. #define CHARSTR    5
  47. #define PMV2I    6
  48. #define PDR2I    7
  49. #define PCLOS    8
  50. #define RECTI    9
  51. #define CLEAR    10
  52. #define ENDLINE 11
  53. #define PUSHVP    12
  54. #define POPVP    13
  55. #define VP    14
  56.  
  57. extern short ditherflag;
  58.  
  59. void charstr(char *s, int font)
  60. {
  61.     int len = (int) strlen(s);
  62.     int i;
  63.     void **f;
  64.     switch(font) {
  65.     case UI_FONT_BOLD:
  66.     case UI_FONT_NORMAL:
  67.         f = GLUT_BITMAP_HELVETICA_12;
  68.         break;
  69.     case UI_FONT_FIXED_PITCH:
  70.         f = GLUT_BITMAP_9_BY_15;
  71.         break;
  72.     }
  73.     for (i = 0; i < len; i++)
  74.     glutBitmapCharacter(f, s[i]);
  75. }
  76.  
  77. void uipushviewport(void)
  78. {
  79. }
  80.  
  81. void uipopviewport(void)
  82. {
  83.     glDisable(GL_SCISSOR_TEST);
  84. }
  85.  
  86. void uiviewport(int x, int y, int width, int height)
  87. {
  88.     glScissor(x, y, width, height);
  89.     glEnable(GL_SCISSOR_TEST);
  90. }
  91.  
  92. void uicharstr(char *s, int font)
  93. {
  94.     charstr(s, font);
  95. }
  96.  
  97. void uirecti(int x, int y, int z, int w)
  98. {
  99.     glBegin(GL_LINE_LOOP);
  100.     glVertex2i(x, y);
  101.     glVertex2i(x, w);
  102.     glVertex2i(z, w);
  103.     glVertex2i(z, y);
  104.     glEnd();
  105. }
  106.  
  107. void uirectfi(int x, int y, int x1, int y1)
  108. {
  109.     glRecti(x, y, x1, y1);
  110. }
  111.  
  112. void uipclos(void)
  113. {
  114.     glEnd();
  115. }
  116.  
  117. void uiclear(void)
  118. {
  119.     glClearColor(214.0/255.0, 214.0/255.0, 214.0/255.0, 0.0);
  120.     glClear(GL_COLOR_BUFFER_BIT);
  121. }
  122.  
  123. void uipdr2i(int x, int y)
  124. {
  125.     glVertex2i(x, y);
  126. }
  127.  
  128. void uipmv2i(int x, int y)
  129. {
  130.     glBegin(GL_POLYGON);
  131.     glVertex2i(x, y);
  132. }
  133.  
  134. void uicmov2i(int x, int y)
  135. {
  136.     glRasterPos2i(x, y);
  137. }
  138.  
  139. void uidraw2i(int x, int y)
  140. {
  141.     glVertex2i(x, y);
  142. }
  143.  
  144. void uiendline(void)
  145. {
  146.     glEnd();
  147. }
  148.  
  149. void uimove2i(int x, int y)
  150. {
  151.     glBegin(GL_LINE_STRIP);
  152.     glVertex2i(x, y);
  153. }
  154.  
  155.